package cn.lin.controller;

import cn.lin.service.HeaderService;
import cn.lin.util.Result;
import cn.lin.vo.HeaderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: Mr.s huang
 * @Date: 2024/12/3
 * 渲染头部信息
 */
@RestController
@RequestMapping("/header")
public class HeaderController {

    @Autowired
    private HeaderService headerService;

    @GetMapping("/info")
    public Object showHeaderInfo(@RequestParam("classId") Integer classId) {

        System.out.println(classId);

        List<HeaderVO> list = headerService.showHeaderInfo(classId);

        if (list == null) {
            return Result.error("获取失败");
        }
        return Result.ok("获取成功", list);
    }

}
